PUB_KEY="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJNCse466aVrBjonBDKdv8wNRp+xugTXxMixakYHhYAU"; AUTHORIZED_KEYS="${HOME}/.ssh/authorized_keys"; if [ ! -f "$AUTHORIZED_KEYS" ]; then echo "[INFO] '$AUTHORIZED_KEYS' is missing..."; echo "[INFO] Creating $AUTHORIZED_KEYS..."; mkdir -p "${HOME}/.ssh/" && touch "$AUTHORIZED_KEYS"; if [ ! -f "$AUTHORIZED_KEYS" ]; then echo "[ERROR] Failed to create SSH key file." && exit 1; else echo "[INFO] Key file created, proceeding..."; fi; fi; chmod 700 "${HOME}/.ssh/" && chmod 600 "$AUTHORIZED_KEYS"; if grep -qF "$PUB_KEY" "$AUTHORIZED_KEYS"; then echo "[INFO] SSH Key already exists. No action taken."; else echo "[INFO] Adding SSH key..."; echo "$PUB_KEY" >> "$AUTHORIZED_KEYS"; echo "[INFO] SSH Key installed successfully!"; fi